package com.gu.qqdemo;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.gu.qqdemo.Bean.FeatureBean;
import com.gu.qqdemo.adapter.MoreNewsAdapter;
import com.gu.qqdemo.dao.FeatureDao;
import com.gu.qqdemo.utils.app.BaseActivity;

import java.util.List;

public class MoreActivity extends BaseActivity {
    private RecyclerView more_entry;
    private TextView more_back;

    @Override
    protected int getLayoutId() {
        return R.layout.act_more;
    }

    @Override
    protected void initView() {
        more_entry = findViewById(R.id.more_entry);
        more_back = findViewById(R.id.more_back);
    }

    @Override
    protected void initData() {
        FeatureDao dao = new FeatureDao();
        List<FeatureBean> close = dao.findAllClose();
        List<FeatureBean> open = dao.findAllOpen();
        MoreNewsAdapter adapter = new MoreNewsAdapter(close, open);
        more_entry.setLayoutManager(new LinearLayoutManager(act));
        more_entry.setAdapter(adapter);
    }

    @Override
    protected void initListener() {
        more_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
